<?php

$url = 'https://www.kj1868.com/view/api/lhGame/lastLotterys/am6.lh';//澳门
//$url = 'https://www.kj1868.com/view/api/lhGame/lastLotterys/xg6.lh';//香港
//$url = 'https://www.kj1868.com/view/api/lhGame/lastLotterys/nam6.lh';//新澳
$useragent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36';
$timeout= 120;
$dir = dirname(__FILE__);
$cookie_file = 'C3VK=49f0a2';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt($ch, CURLOPT_ENCODING, "" );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_AUTOREFERER, true );
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout );
curl_setopt($ch, CURLOPT_MAXREDIRS, 10 );
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com/');
$content = curl_exec($ch);
if(curl_errno($ch))
{
    echo 'error:' . curl_error($ch);
}
else
{
    $data = json_decode($content, true);
    $issue = $data['data']['historyLotterys']['0']['period'];
    $openCode = $data['data']['historyLotterys']['0']['numbers'];
    $openTime = $data['data']['historyLotterys']['0']['lottery_date'];
    //echo '澳门第'.$issue.'期开奖结果为:'.$openCode.'开奖时间为'.$openTime;
    //echo '新澳第'.$issue.'期开奖结果为:'.$openCode.'开奖时间为'.$openTime;
   // echo '香港第'.$issue.'期开奖结果为:'.$openCode.'开奖时间为'.$openTime;

}
curl_close($ch);

?>

[{"opentime":"<?=$openTime?>","opencode":"<?=$openCode?>","expect":"<?=$issue?>"}]